#@layout("代理规则")
#define main()
<body class="timo-layout-page">
    <div class="layui-card">
        <div class="layui-card-header timo-card-header">
            <span><i class="fa fa-bars"></i>代理规则</span>
            <i class="layui-icon layui-icon-refresh refresh-btn"></i>
        </div>
        <div class="layui-card-body">
            <div class="layui-tab layui-tab-brief" lay-filter="fetchRecommendRule">
                <ul class="layui-tab-title">
                    #for(item : recommendRuleList)
                    <li #if(for.index==0) class="layui-this" #end lay-id="#(for.index)">#(joyDict.getDictLabel(item.recType.toString(),'recommend_level','未知'))</li>
                    #end
                </ul>
                <div class="layui-tab-content">
                    #for(item : recommendRuleList)
                    <div class="layui-tab-item #if(for.index==0) layui-show #end">
                        <div class="layui-form timo-compile">
                            <form action="#(ctxAd)/recommend/save" id="#(item.id)">
                                <input type="hidden" name="recommendRule.id"  value="#(item.id ??)"/>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">代理名称</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" id="recName" type="text" disabled value="#(joyDict.getDictLabel(item.recType.toString(),'recommend_level','未知'))">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">一级返佣</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" id="recVal1" lay-verify="required|recVal" type="text" name="recommendRule.recVal1"  placeholder="一级代理分成比例" autocomplete="off" value="#(item.rec_val1)">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">%</div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">二级返佣</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" id="recVal2" lay-verify="required|recVal" type="text" name="recommendRule.recVal2"  placeholder="二级代理分成比例" autocomplete="off" value="#(item.rec_val2)">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">%</div>
                                </div>
                                <div class="layui-form-item layui-form-text">
                                    <label class="layui-form-label">三级返佣</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" id="recVal3" lay-verify="required|recVal" type="text" name="recommendRule.recVal3"  placeholder="三级代理分成比例" autocomplete="off" value="#(item.rec_val3)">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">%</div>
                                </div>
                                <div class="layui-form-item layui-form-text">
                                    <label class="layui-form-label">充值金额</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" id="recAmount" lay-verify="required|amount" type="text" name="recommendRule.recAmount"  placeholder="充值金额规则" value="#(item.rec_amount)">
                                    </div>
                                </div>
                                <div class="layui-form-item timo-finally">
                                    <button class="layui-btn ajax-submit" lay-submit lay-filter="ajax-submit"><i class="fa fa-check-circle"></i> 保存</button>
                                </div>
                            </form>
                        </div>
                    </div>
                    #end
                </div>
            </div>
        </div>
    </div>
</body>
#end
#define js()
<script type="text/javascript" src="#(ctxAdSt)/js/plugins/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="#(ctxAdSt)/js/plugins/jquery.cookie.js"></script>
<script>
	var $;
    layui.use(['layer'], function() {
    	$('.layui-tab-title li').click(function(){
            $.cookie('_cfg_tab', $(this).attr('lay-id'));
        });
        
        var cfgtab =  $.cookie('_cfg_tab');
        if(cfgtab != undefined){
        	$('[lay-id="'+cfgtab+'"]').click();
        }
    });
</script>
#end